<?php

class listagem_model extends CI_Model{


	function get_all(){
	
		//$query = $this->db->query("select * from usuarios");
		$query = $this->db->get('users');
		return $query->result();
	}
        
        public function getCargos(){
            $this->db->select('id, nome_cargo');
            $this->db->order_by("nome_cargo", "asc"); 
            $values = $this->db->get('cargo')->result_array();
            
            $options = array();
            $options[''] = '-Selecione-';
            foreach($values as $value){
		$options[$value['id']] = $value['nome_cargo'];
            }
            return $options;
        }
        
        public function getDiretorias(){
            $this->db->select('id, nome_diretoria');
            $this->db->order_by("nome_diretoria", "asc"); 
            $values = $this->db->get('diretoria')->result_array();
            
            $options = array();
            $options[''] = '-Selecione-';
            foreach($values as $value){
		$options[$value['id']] = $value['nome_diretoria'];
            }
            return $options;
        }
        
        public function getNucleos(){
            $this->db->select('id, nucleo');
            $this->db->order_by("nucleo", "asc"); 
            $values =  $this->db->get('nucleo')->result_array();
            
            $options = array();
            $options[''] = '-Selecione-';
            foreach($values as $value){
		$options[$value['id']] = $value['nucleo'];
            }
            return $options;
        }
        
        
         public function getFaltas($id){
             
            $this->db->select('membro.*');
            $this->db->where('id', $id);
            
            return $this->db->get('membro')->result();
            
        }
}
?>